From 586b701dbb70df02005151d490338b7d85f18653 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Wed, 6 Apr 2022 01:00:46 +0200
Subject: [PATCH 17/19] libc++: treat long doubles as IEEE754 on musl/ppc

---
 libcxx/include/limits | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libcxx/include/limits b/libcxx/include/limits
index 1fa3a8228..b02c0fa5a 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -432,8 +432,14 @@ protected:
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
 
-#if (defined(__ppc__) || defined(__ppc64__))
+#if defined(__powerpc__) || defined(__powerpc64__)
+#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
+    /* IEEE 754 quadruple or double precision */
+    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+#else
+    /* 128-bit IBM double-double */
     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
+#endif
 #else
     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
 #endif
-- 
2.37.3

